package com.bw.server.adapter

import android.annotation.SuppressLint
import android.graphics.Color
import android.widget.TextView
import com.bw.server.R
import com.bw.server.entity.DeviceEntityItem
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class DeviceAdapter:BaseQuickAdapter<DeviceEntityItem,BaseViewHolder>(R.layout.item_device) {

    override fun convert(holder: BaseViewHolder, item: DeviceEntityItem) {

        holder.getView<TextView>(R.id.device_type).text = item.orderType
        holder.getView<TextView>(R.id.device_address).text = item.address
        holder.getView<TextView>(R.id.device_gzl).text = item.content
        val static = holder.getView<TextView>(R.id.device_zt)
        static.text = item.status
        if (item.status == "新建"){
            static.setBackgroundResource(R.drawable.device_zt2)
            static.setTextColor(Color.WHITE)
        }else if (item.status == "进行中"){
            static.setBackgroundResource(R.drawable.device_zt1)
            static.setTextColor(Color.WHITE)
        }else if (item.status == "已完成"){
            static.setBackgroundResource(R.drawable.device_zt4)
            static.setTextColor(Color.WHITE)
        }else if (item.status == "已转派"){
            static.setBackgroundResource(R.drawable.device_zt3)
            static.setTextColor(Color.WHITE)
        }





    }
}